<!DOCTYPE html>
<html lang="ar">
<head>
    <title>حوالات الدفع</title>
	<?php
	 define('LAST_CAPITRE_ID',19);
	 define('LAST_ARTICLE_CODE',3);
	?>
	
	<?php $this->load->helper('url');?>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta charset="utf-8">
	
	<!---------------------for autocomplete--------------->
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-1.11.0.min.js');?>" ></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-ui-1.10.4/js/jquery-ui-1.10.4.min.js');?>" ></script>
	<link href="<?php echo base_url("assets/css/jquery-ui.css")?>" rel="stylesheet" type="text/css" />
	<!------------------------------------------------------>
	

<script type="text/javascript" src="<?php echo base_url('assets/js/jquery.tablesorter.min.js');?>" ></script>
	<link href="<?php echo base_url("assets/css/ch_menu.css")?>" rel="stylesheet" type="text/css" />
		<link href="<?php echo base_url("assets/css/table.css")?>" rel="stylesheet" type="text/css" />
			 <link href="<?php echo base_url("assets/css/botton.css")?>" rel="stylesheet" type="text/css" />
			 
	<meta charset="utf-8">
	
</head>


<?php include_once('header.php');
	
	
		 $this->load->library('session');
        $chcl=$this->session->userdata('data_charticle'); //access it
     
 ?>
 

<?php
$liste_des_fournisseurs= array();
if($liste_des_fournisseurs){
	foreach ($results_recherche as $lf){
	array_push($liste_des_fournisseurs, $lf->fournisseur);
	}
}

	
$m=0;
	?>
	
	

	<form id="recherche_frm" method="post" action="<?php echo base_url("mondat_ctr/find_mondat_per_fournis/");?>" >
	 <fieldset>
	   <div>
	  <div >
                
				<input id="nom" name="nom" type="text" value="<?php if($results_recherche) echo($results_recherche[0]->nom_fourn_bc);?>">
				<label for="nom">المورد</label>
            </div>
		 <button type="submit" id="submit_btn" >بحث</button>
		   </div>
		  </fieldset>
	</form>

	

<div class = "charticle_browser">
	
<ul class="topmenu" id="css3menu1">
<?php

$mem =0;


for($i = 0; $i < count($chcl); $i++)
{
	if($mem <> $chcl[$i]->id_chapitre)
			{	
				echo('<li class="topmenu"><a style="width:248px;" href="#"><span>
				<img alt="" src="images/sparkle-brown-vertical/info2.png">'. $chcl[$i]->ch_code.' - '.$chcl[$i]->nom_chap.' </span></a>');
				echo('<div style="auto;" class="submenu">');
				echo('<div style="width:100%" class="column">');

			
				echo('<ul><li><a href="'.base_url("mondat_ctr/get_mondat_per_article2/").'/'.$chcl[$i]->id_article.'">
				<img alt="" src="images/sparkle-brown-vertical/bookmarks.png">'.$chcl[$i]->code.'- '.$chcl[$i]->nom_art.'</a></li><br>');

				if(($chcl[$i]->code)== 1 && ($chcl[$i]->id_chapitre == 16))  echo('</ul></div></div></li>'); // patch to fix a unique child
				
			}
			else
			{

				
				echo('<li><a href="'.base_url("mondat_ctr/get_mondat_per_article2/").'/'.$chcl[$i]->id_article.'">
				<img alt="" src="images/sparkle-brown-vertical/bookmarks.png">'.$chcl[$i]->code.'- '.$chcl[$i]->nom_art.'</a></li><br>');

				if($chcl[$i+1]->id_chapitre > $mem) echo('</ul></div></div></li>');
				if(($chcl[$i]->code)== 2 && ($chcl[$i]->id_chapitre == 19))  //if last chapitre et article
				 {

				 
				 	echo('<li><a href="'.base_url("mondat_ctr/get_mondat_per_article2/").'/'.$chcl[$i]->id_article.'">
					<img alt="" src="images/sparkle-brown-vertical/bookmarks.png">'.$chcl[$i]->code.'- '.$chcl[$i+1]->nom_art.'</a></li><br>');

				 	 echo('</ul></div></div></li>');
					//goto end;
					break;
				 }
			}
			    $mem = $chcl[$i]->id_chapitre;	
}	
 ?>
 </ul>
 
</div>

<div id="destination" >
  <h1>حوالات الدفع</h1>
  <div id="body">
  
  <div class="CSS_Table_Example" >
  <table id="myTable" class="tablesorter">
  <thead>
<tr>
     <th>  المورد </th>
   <th>    المبلغ   </th>
   <th>  الصك  </th>
   <th>  التاريخ </th>
   <th>  رقم حوالة الدفع </th> 
</tr>
</thead>
<tbody>
<?php

if($results)
foreach($results as $data) 
{
/*if($data->nom_fourn_bc){
	$fournisseur=$data->nom_fourn_bc;
}elseif($data->nom_four_conv) {
	$fournisseur=$data->nom_four_conv;
}*/
	echo '<tr >
	<td>'.$data->fournisseur.'</td>
	 <td>'.$data->montant.'</td>	 
	   <td>'.$data->numero_cheque.'</td>
	    <td>'.$data->date.'</td>
		    <td> <a href='.base_url("/mondat_ctr/details_mondat/$data->id_mandat").'>'.$data->num_mondat.'</a></td>
		  </tr>'  ;
	
}

  
?>
</tbody>
</table>
</div>
<div class="pagination_numero">
 <p><?php echo $links; ?></p>
 </div>
 <div style="position: relative; left: 10%;">  
<a href="<?php echo base_url("/budget_ctr/load/budget_vew")?>" class="botton">خروج</a>


</div>
  </div>
 
</div>
  <script>
 $(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
); 
 </script>   
 <script>
$(function() {
	var liste_fourniss = <?php echo json_encode($liste_des_fournisseurs); ?>;
	$( "#nom" ).autocomplete({source: liste_fourniss});
	} 
); 
</script> 
</html>